package com.ionehe.group.common.async.model;

import com.ionehe.group.common.async.util.AsyncSerializeUtil;
import lombok.Data;

import java.io.IOException;
import java.io.Serializable;

/**
 * Copyright (c) 2021 ionehe.com
 * Date: 2021/4/21
 * Time: 1:22 下午
 *
 * @author 2021年 <a href="mailto:a@ionehe.com">秀</a>
 * 【异步消息实体类】
 */
@Data
public class Message implements Serializable {
    private static final long serialVersionUID = 320725350416262160L;
    private String tag;
    private byte[] body;


    @Override
    public String toString() {
        try {
            return String.format("tag=%s,body=%s", new Object[]{this.tag, AsyncSerializeUtil.deserialize(this.body)});
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
}